package world.snowcrystal.utils;


import jakarta.servlet.http.HttpServletRequest;
import world.snowcrystal.dao.UserAuthenticationDetails;

public class RequestUtils {

    public static void setRequestUsername(HttpServletRequest request, String username) {
        request.setAttribute("username", username);
    }
    public static String getRequestUsername(HttpServletRequest request) {
        return (String) request.getAttribute("username");
    }


    public static void setAuthenticatedUser(HttpServletRequest request, UserAuthenticationDetails authentication){
        request.setAttribute("_AuthenticatedUser_", authentication);
    }

    public static UserAuthenticationDetails getAuthenticatedUser(HttpServletRequest request){
       return (UserAuthenticationDetails) request.getAttribute("_AuthenticatedUser_");
    }

}
